package com.dailyblue.java.cloud.sentinel.consumer.service.impl;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.dailyblue.java.cloud.sentinel.consumer.feign.ProviderFeign;
import com.dailyblue.java.cloud.sentinel.consumer.service.ConsumerService;
import com.dailyblue.java.commons.util.JsonResult;
import com.dailyblue.java.commons.util.ResultTool;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class ConsumerServiceImpl implements ConsumerService {
    @Resource
    private ProviderFeign providerFeign;

    @Override
    public JsonResult a() {
        return providerFeign.a();
    }

    @Override
    public JsonResult b() {
        return providerFeign.b();
    }

    @SentinelResource("messageC")
    public JsonResult c() {
        log.info("ConsumerServiceImpl被调用了！");
        return ResultTool.success("This is C method!");
    }
}
